package com.jxs.tourist.service.impl;

import com.jxs.tourist.dao.NewsDao;
import com.jxs.tourist.domain.News;
import com.jxs.tourist.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    NewsDao newsDao;
    public NewsServiceImpl(){
        System.out.println("init");
    }

    public int addNews(News news) {
        return newsDao.addNews(news);
    }

    public List<News> getAllNews() {
        return newsDao.getAllNews();
    }
    public int deleteNewsById(int id) {
        return newsDao.deleteNewsById(id);
    }

    public int editNews(News news) {
        return newsDao.editNews(news);
    }

    public News getNewsById(int id) {
        return newsDao.getNewsById(id);
    }
}
